package com.tank.demo.abstractFactory;

import com.tank.demo.facadeAndMediator.GameModel;
import com.tank.demo.myenum.DirEnum;
import com.tank.demo.myenum.TankGroupEnum;
import com.tank.demo.utils.ResourceMgr;
import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
public abstract class BaseBullet extends BaseGameObject {

    public static final int SPEED = 20;

    public DirEnum dir;
    public TankGroupEnum group;

    public void die() {
        GameModel.getInstance().remove(this);
    }

    public BaseBullet(Integer x, Integer y, DirEnum dir, TankGroupEnum group) {
        this.x = x;
        this.y = y;
        this.dir = dir;
        this.group = group;
        switch (dir){
            case DOWN:case UP:
                this.width = ResourceMgr.bulletU.getWidth();
                this.height = ResourceMgr.bulletU.getHeight();
                break;
            case LEFT:case RIGHT:
                this.width = ResourceMgr.bulletL.getWidth();
                this.height = ResourceMgr.bulletL.getHeight();
                break;
        }
    }

}
